package com.erlang.springmvc.controller;

import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.servlet.ModelAndView;

/**
 * @Description：ModelAndView返回类型
 */
@Controller
@RequestMapping(value = "model-view-type")
public class ModelAndViewTypeController {

    /**
     * @Description ModelAndView返回类型
     * 使用默认类型model传递数据
     * 构建视图之后指定视图目标路径跳转 
     */
    @RequestMapping
    public ModelAndView defaultMethod(Model model){
        ModelAndView modelAndView = new ModelAndView();
        model.addAttribute("content", "ModelAndViewType");
        modelAndView.setViewName("succeed");
        return modelAndView;
    }
}